@Set STSADM="%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE"

:: Check command line arguments
@IF "%~1"=="" GOTO Syntax
@SET URL=%~1

@echo Undeploying ECTS Solution from %URL%

%STSADM% -o deactivatefeature -name ExternalCollaboration -url %URL%
%STSADM% -o deactivatefeature -name ConfigurationUtility -url %URL%
%STSADM% -o deactivatefeature -name SiteCollectionApproval -url %URL%
%STSADM% -o deactivatefeature -name SiteCollectionManager -url %URL%
%STSADM% -o deactivatefeature -name UserManager -url %URL%
%STSADM% -o deactivatefeature -name CreateSiteCollection -url %URL%
%STSADM% -o deactivatefeature -name ExternalUserApproval -url %URL%
%STSADM% -o deactivatefeature -name ECTSBase -url %URL%

%STSADM% -o retractsolution -name ECTSSolution.wsp -immediate -url %URL%
%STSADM% -o retractsolution -name ECTSBase.wsp -immediate -url %URL%
%STSADM% -o execadmsvcjobs

%STSADM% -o deletesolution -name ECTSSolution.wsp -override
%STSADM% -o deletesolution -name ECTSBase.wsp -override
%STSADM% -o execadmsvcjobs

@GOTO End

:Syntax

@echo Must specify the URL for the web application

:End
